<template>
  <HeaderMenu />
  <SiderMenu />
</template>

<script>
import HeaderMenu from './components/HeaderMenu.vue';
import SiderMenu from './components/SiderMenu.vue';
import store from './store';

export default {
  name: 'App',
  components: {
    HeaderMenu,
    SiderMenu,
  }
}

// 全局监听浏览器刷新事件
window.addEventListener('beforeunload', () => {
  console.log("触发刷新");
  console.log(store.state.user)
  if (store.state.user.is_login) {
    localStorage.setItem('user', JSON.stringify(store.state.user));
  }
})

window.onload = () => {
  console.log("刷新完成")
  let local_user = localStorage.getItem('user');
  store.commit("UserRebuild", local_user);
}


</script>

<style></style>
